package com.qing.servicebase.exception;

import com.qing.servicebase.utils.ResponseState;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 异常基类
 * @Author rokies
 * @DATE 2022/6/25 22:20
 * @Version 1.0
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BaseException extends RuntimeException {
    private Integer code;
    private String message;

    public BaseException(ResponseState responseState) {
        super(responseState.getMessage());
        this.code = responseState.getCode();
        this.message = responseState.getMessage();
    }

    public BaseException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }
}
